Drop gdk_display_get_monitor_at_point
authorMatthias Clasen <mclasen@redhat.com>
Wed, 29 May 2019 05:50:48 +0000 (05:50 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 29 May 2019 18:04:08 +0000 (18:04 +0000)
This api expects global coordinates, and
is unused.

docs/reference/gdk/gdk4-sections.txt
gdk/gdkdisplay.c
gdk/gdkdisplay.h
gdk/gdksurface.c

index 0ae697f89468370c781d981508555a7965cbfd95..fa1b832a4fadb47fc3b53ef3bfbc39b8afe3a93d 100644 (file)
@@ -95,7 +95,6 @@ gdk_display_list_seats
 gdk_display_get_n_monitors
 gdk_display_get_monitor
 gdk_display_get_primary_monitor
-gdk_display_get_monitor_at_point
 gdk_display_get_monitor_at_surface
 gdk_display_get_clipboard
 gdk_display_get_primary_clipboard
index c657d66133d23079cc509e4fccb96d6c8398f3ce..42444908949d38f9220d4cbaabd06c3b7cfb4985 100644 (file)
@@ -1614,66 +1614,6 @@ gdk_display_get_primary_monitor (GdkDisplay *display)
   return GDK_DISPLAY_GET_CLASS (display)->get_primary_monitor (display);
 }
 
-/**
- * gdk_display_get_monitor_at_point:
- * @display: a #GdkDisplay
- * @x: the x coordinate of the point
- * @y: the y coordinate of the point
- *
- * Gets the monitor in which the point (@x, @y) is located,
- * or a nearby monitor if the point is not in any monitor.
- *
- * Returns: (transfer none): the monitor containing the point
- */
-GdkMonitor *
-gdk_display_get_monitor_at_point (GdkDisplay *display,
-                                  int         x,
-                                  int         y)
-{
-  GdkMonitor *nearest = NULL;
-  int nearest_dist = G_MAXINT;
-  int n_monitors, i;
-
-  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-
-  n_monitors = gdk_display_get_n_monitors (display);
-  for (i = 0; i < n_monitors; i++)
-    {
-      GdkMonitor *monitor;
-      GdkRectangle geometry;
-      int dist_x, dist_y, dist;
-
-      monitor = gdk_display_get_monitor (display, i);
-      gdk_monitor_get_geometry (monitor, &geometry);
-
-      if (x < geometry.x)
-        dist_x = geometry.x - x;
-      else if (geometry.x + geometry.width <= x)
-        dist_x = x - (geometry.x + geometry.width) + 1;
-      else
-        dist_x = 0;
-
-      if (y < geometry.y)
-        dist_y = geometry.y - y;
-      else if (geometry.y + geometry.height <= y)
-        dist_y = y - (geometry.y + geometry.height) + 1;
-      else
-        dist_y = 0;
-
-      dist = dist_x + dist_y;
-      if (dist < nearest_dist)
-        {
-          nearest_dist = dist;
-          nearest = monitor;
-        }
-
-      if (nearest_dist == 0)
-        break;
-    }
-
-  return nearest;
-}
-
 /**
  * gdk_display_get_monitor_at_surface:
  * @display: a #GdkDisplay
@@ -1727,12 +1667,7 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
         }
     }
 
-  if (best)
-    return best;
-
-  return gdk_display_get_monitor_at_point (display,
-                                           win.x + win.width / 2,
-                                           win.y + win.height / 2);
+  return best;
 }
 
 void
index 547e2a10de645cf3cb0c2081309f751830d7e594..aa17eab9bba25e68c23b26401b04b3fffcc139cd 100644 (file)
@@ -114,10 +114,6 @@ GdkMonitor * gdk_display_get_monitor           (GdkDisplay *display,
 GDK_AVAILABLE_IN_ALL
 GdkMonitor * gdk_display_get_primary_monitor   (GdkDisplay *display);
 GDK_AVAILABLE_IN_ALL
-GdkMonitor * gdk_display_get_monitor_at_point  (GdkDisplay *display,
-                                                int         x,
-                                                int         y);
-GDK_AVAILABLE_IN_ALL
 GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display,
                                                 GdkSurface  *surface);
 
index a65e5bcaeaec71f5a3f391134b25ee85a4804da8..4e5620ff0759f844cf21d979bd10782071f2e85d 100644 (file)
@@ -146,8 +146,6 @@ get_monitor_for_rect (GdkDisplay         *display,
   GdkMonitor *monitor;
   GdkRectangle workarea;
   GdkRectangle intersection;
-  gint x;
-  gint y;
   gint i;
 
   for (i = 0; i < gdk_display_get_n_monitors (display); i++)
@@ -165,13 +163,7 @@ get_monitor_for_rect (GdkDisplay         *display,
         }
     }
 
-  if (best_monitor)
-    return best_monitor;
-
-  x = rect->x + rect->width / 2;
-  y = rect->y + rect->height / 2;
-
-  return gdk_display_get_monitor_at_point (display, x, y);
+  return best_monitor;
 }
 
 static gint